#ifndef TIMAGE_H
#define TIMAGE_H

#include "../Config/Export.h"
#include "../Core/IDrawable.h"
#include "../Core/Texture.h"
#include "../Maths/TVector2.h"

namespace epix {

template<class Drawer>
class SHARED TImage : public IDrawable, public Drawer
{
    public:

		TImage(Texture *texture, int posX = 0, int posY = 0);
		TImage(const char *filename, int posX = 0, int posY = 0);
        virtual ~TImage();
        
        void load(Texture *texture);
        void load(const char *filename);

        void setPosition(int posX = 0, int posY = 0);
        void setSize(int width, int height);

        const Vector2i &getSize() const;
        const Vector2i &getPosition() const;
        
        Texture *getTexture();
        
        void save(const char *filename);
        
        virtual void clear();

        virtual void draw();

    private:

        virtual void create();
        virtual void update();

        TImage(TImage&);
        TImage &operator=(const TImage &);
	
		Texture *_texture;
        Vector2i _size, _pos;
        float _tex_pos[8], _img_pos[8];

};

#include "TImage.inl"

}

#endif
